VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "TestStringMessage"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit

Private mMessage As StringMessage
Private mResult As String
Private mValue As Integer

Public Sub testTrue()
givenStringMessage
whenCalledWith True, "a", "a"
thenMessageIs "a is the same as a"
End Sub
Public Sub testFalse()
givenStringMessage
whenCalledWith False, "a", "b"
thenMessageIs "a is not the same as b"
End Sub

Public Sub xtestLongStringsFalse()
givenStringMessage
whenCalledWith False, "different1", "different2"
thenMessageIs "Expected: <...rent1>" & vbCrLf + _
                "but got:  <...rent2>" & vbCrLf + _
                "First difference: ^" & vbCrLf + _
                "index 10 ---------|"
End Sub

Public Sub testFirstDifferenceEqual()
givenStringMessage
whenDifferenceCalledWith "", ""
thenResultIs 1
End Sub
Public Sub testFirstDifference1()
givenStringMessage
whenDifferenceCalledWith "", "a"
thenResultIs 1
End Sub
Public Sub testFirstDifference2()
givenStringMessage
whenDifferenceCalledWith "ab", "ac"
thenResultIs 2
End Sub
Public Sub testFirstDifference3()
givenStringMessage
whenDifferenceCalledWith "ab", "ab"
thenResultIs 3
End Sub
Public Sub testFirstDifference6()
givenStringMessage
whenDifferenceCalledWith "abcde0ghij", "abcdefghij"
thenResultIs 6
End Sub


''
Private Sub givenStringMessage()
Set mMessage = New StringMessage
End Sub
Private Sub whenCalledWith(result As Boolean, LHS As String, RHS As String)
mResult = mMessage.message(result, LHS, RHS)
End Sub
Private Sub whenDifferenceCalledWith(LHS As String, RHS As String)
mValue = mMessage.firstDifferenceIndex(LHS, RHS)
End Sub
Private Sub thenMessageIs(message As String)
assert.equals mResult, message, "Message should be " + message
End Sub
Private Sub thenResultIs(value As Integer)
assert.equals mValue, value, "Result should be " + CStr(value)
End Sub


'OPTIONAL METHODS
Public Function NumOfAsserts() As Long
NumOfAsserts = 7
End Function

